package com.owc.dao;

import com.owc.domain.dto.DetailBean;
import com.owc.domain.dto.FlowDetail;
import com.owc.domain.entity.WithdrawFlow;

import java.math.BigDecimal;
import java.util.List;

import com.owc.domain.vo.admin.WithdrawVo;
import org.apache.ibatis.annotations.Param;

public interface WithdrawFlowMapper extends BaseMapper<WithdrawFlow, Long> {
    /**
     * 获取正在转账中的订单总金额
     */
    BigDecimal selectPendingWithdrawAmount(@Param("tokenId") Long tokenId, @Param("userId") Long userId);

    /**
     * 获取所有的流水订单 (包括转账和充值)
     */
    List<DetailBean> selectAllFlowList(@Param("userId") Long userId, @Param("type") Integer type, @Param("tokenId") Long tokenId);

    /**
     * 获取流水详情
     */
    FlowDetail selectFlowDetail(@Param("flowId") String flowId);

    /**
     * 获取转账订单
     */
    List<WithdrawFlow> selectByQueryModel(@Param("queryModel") WithdrawVo withdrawVo);

    /**
     * 获取满足transferIds集合的订单
     */
    List<WithdrawFlow> selectByIds(@Param("transferIds") List<String> transferIds);

    /**
     * 获取订单 根据交易单号查询
     *
     * @param transferId 交易单号
     */
    WithdrawFlow selectById(@Param("transferId") String transferId);

    /**
     * 修改提现订单状态
     *
     * @param trace  交易单号
     * @param status 状态
     */
    void updateStatusByTransferId(@Param("trace") String trace, @Param("status") Integer status);

    /**
     * 根据userId和
     *
     * @param userid
     * @param tokenId
     * @param status
     */
    void updateStatusByUserAndTokenId(@Param("userid") Long userid, @Param("tokenId") Long tokenId, @Param("status") Integer status);

    void updateFinishTimeByTrace(@Param("trace") String trace, @Param("finishTime") String finishTime);

    WithdrawFlow selectProgressOrderByUserId(@Param("currentUserId") Long currentUserId);

    WithdrawFlow selectProgressOrderByUserIdAndTokenName(@Param("userId") Long userId, @Param("tokenName") String tokenName);

    void updateRemake(@Param("withdrawflowid") String withdrawflowid, @Param("message") String message);

    /**
     * 更新信息
     *
     * @param flow 更新信息模型
     */
    void updateByTrace(WithdrawFlow flow);

    /**
     * 更新交易hash
     * @param withdrawflowid  订单ID
     * @param txnHash 交易Hash
     */
    void updateTxHash(@Param("withdrawflowid") String withdrawflowid, @Param("txnHash") String txnHash);
}